<template>
  <view
    class="content"
    :style="{
      'padding-top': height + 'px',
    }"
  >
    <view
      :style="{
        width: '100%',
        height: statusBarHeight + 'px',
        background: 'white',
        position: 'fixed',
        top: 0,
        zIndex: 100,
      }"
    >
    </view>
    <view
      class="head"
      :style="{
        top: statusBarHeight + 'px',
        background: 'white',
      }"
    >
      <view class="head_left">
        <u-icon
          name="arrow-left"
          color="#444444"
          size="24"
          :bold="true"
          @click="toBack"
        ></u-icon>
      </view>
      <view class="text">{{ detail.title }}</view>
    </view>
    <view
      class="box"
      :style="{ marginTop: statusBarHeight + 'px' }"
    >
      <!-- <u-badge type="primary" max="99" :value="value"></u-badge> -->
      <!-- <u-parse :content="content" @linkTap="linkTap"></u-parse> -->
      <u-parse :content="detail.content" @linkTap="linkTap"></u-parse>
    </view>


    <floatingBall></floatingBall>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0,
      height: 0,
      content: `
					  <a href="/pages/home/personCoCreate?name=三次" >三次<span >(55)</span></a>
				`,
      detail: {},
      id: "",
      value: 100,
    };
  },
  onLoad(options) {
    this.id = options.id;
  },
  created() {
    const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度
    this.statusBarHeight = statusBarHeight.statusBarHeight;
    this.$nextTick(() => {
      uni
        .createSelectorQuery()
        .select(".head")
        .boundingClientRect((data) => {
          this.height = data.height + 47;
        })
        .exec();
    });
    this.getDetail();
  },
  methods: {
    toBack() {
      uni.navigateBack({
        delta: 1,
      });
    },
    linkTap(e) {
      console.log("eeee", e);
    },
    getDetail() {
      this.$http
        .gongchuangDetail({ id: this.id })
        .then((res) => {
          this.detail = res.data.detail;

          console.log(this.detail, "共创图书章节详情");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
  },
};
</script>

<style scoped lang="scss">
.content {
  box-sizing: border-box;
}

.head {
  width: 100%;
  padding: 18rpx 30rpx 47rpx;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 99;

  .head_left {
    position: absolute;
    left: 30rpx;
  }

  .text {
    font-size: 36rpx;
    font-family: PingFang SC-Bold, PingFang SC;
    font-weight: 400;
    color: #444444;
  }
}
.box {
  width: 100%;
  padding: 0 30rpx;
  box-sizing: border-box;
}
</style>